﻿@using LeadMaster.Helpers
@using LeadMaster.Properties

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Dunsmore Lead Generation Management Console</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />

        @Styles.Render("~/Content/themes/base/css", "~/Content/css")
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
        @Scripts.Render("~/bundles/jqueryval")
        <script src="~/Scripts/jquery.maskedinput.min.js" type="text/javascript"></script>
        <script src="~/Content/chosen/chosen.jquery.min.js" type="text/javascript"></script>
        <link href="~/Content/chosen/chosen.css" rel="stylesheet" type="text/css" />

        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">

        <!-- Optional theme -->
        <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap-theme.min.css">

        <!-- Latest compiled and minified JavaScript -->
        <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>


        <link href="~/Content/Site.css" rel="stylesheet" type="text/css" />

        <script type="text/javascript">
            $().ready(function () {
                $.ajaxSetup({ cache: false });
            });
        </script>
    </head>
    <body class="mainbody" 
    @if(!this.User.IsInRole(ApplicationRoles.Operations))
    {
    @:style="width: 1400px;"
    }
    >
    <div class="container_12">
        <div class="alpha grid_12 omega">
        <header>
            <div class="logo" style="vertical-align: middle; width:700px; text-align: left;">
                <img src="~/Images/lead-generation-specialists.jpg" style="border: none" alt="Dunsmore Marketing Ltd"/>
                <label style="font-family: 'Trebuchet MS'; font-size: 18px; ">Orac v2.0 Survey Edition</label>
            </div>
            <nav>
            
            @if (this.User.IsInRole(ApplicationRoles.Legal))
            {
            <ul>
            <li>
                <a href="#" class="menucontents">Lead/Data Types</a>
                <ul>
                    <li><a href="@(Url.Action("Index", "FrameworkAgreements"))" class="menucontents">Framework Agreements</a></li>
                    <li><a href="@(Url.Action("Index", "TermConditions"))" class="menucontents">Terms & Conditions</a></li>
                    <li><a href="@(Url.Action("Index", "Schedules"))" class="menucontents">Order Templates</a></li>
                </ul>
            </li>
            </ul>   
            }
            
          
            @if (this.User.Identity.Name.Trim().Length > 0)
            {
            <ul style="float: right;">
                <li style="width: 300px">
                    <a href="#" class="menucontents">User</a>
                    <ul>
                        <li style="width: 100px"><a href="@(Url.Action("Logoff", "Account"))" id="loggingout" class="menucontents">Logout</a></li>
                        @if (this.User.IsInRole(ApplicationRoles.Administrator))
                        {
                            <li><a href="@(Url.Action("AddRole", "Account"))" class="menucontents">Add Role</a></li>
                            <li><a href="@(Url.Action("AssignUserRole", "Account"))" class="menucontents">Assign User Role</a></li>
                            <li><a href="@(Url.Action("Login", "Account"))" class="menucontents">Delete User - not ready</a></li>
                            <li><a href="@(Url.Action("Index", "ClientUsers"))" class="menucontents">Assign Client User</a></li>
                        }
                    </ul>
                </li>
            </ul>
            }
            
            @if (this.User.IsInRole(ApplicationRoles.Legal) || this.User.IsInRole(ApplicationRoles.Operations) || this.User.IsInRole(ApplicationRoles.Administrator))
            {
                <ul style="float: right; margin-right: 0px;">
                    <li style="width: 300px">
                    <a href="#" class="menucontents">Actions</a>
                    <ul>
                    @if (this.User.IsInRole(ApplicationRoles.Legal))
                    {
                    <li style="width: 200px"><a href="@(Url.Action("Index", "ScheduleSections"))" class="menucontents">Legal Sections</a></li>
                    <li style="width: 200px"><a href="@(Url.Action("Index", "Sectors"))" class="menucontents">Survey Categories</a></li>
                    }
                    @if (this.User.IsInRole(ApplicationRoles.Operations) && 1==2)
                    {
                    <li style="width: 200px"><a href="@(Url.Action("Index", "LeadsReplacement"))" class="menucontents maintenance">Leads Replacement</a></li>
                    <li style="width: 200px"><a href="@(Url.Action("Index", "PaymentTerms"))" class="menucontents maintenance">Payment Terms</a></li>
                    <li style="width: 200px"><a href="@(Url.Action("Index", "Invoicing"))" class="menucontents maintenance">Invoicing</a></li>
                    }
                    @if (this.User.IsInRole(ApplicationRoles.Operations))
                    {
                        <li style="width: 200px"><a href="@(Url.Action("Index", "Home"))" class="menucontents maintenance">Clients</a></li>
                        <li style="width: 200px"><a href="@(Url.Action("Index", "LeadBuilder"))" class="menucontents maintenance">LeadBuilder</a></li>
                        <li style="width: 200px"><a href="@(Url.Action("Index", "PurchaseOrder"))" class="menucontents maintenance">Purchase Orders</a></li>    
                    }
                    @if (this.User.Identity.Name == "karl_commercial" && 1 == 2)
                    {
                    <li style="width: 200px"><a href="@(Url.Action("DavidAlerts", "Leads"))" class="menucontents">Email Nudges</a></li>
                    }
                    <li style="width: 200px"><a href="@(Url.Action("Index", "CallCentres"))" class="menucontents">Call Centres</a></li>
                    <li>
                    <a href="http://webellas.arvixevps.com/ReportServer_SQLEXPRESS/Pages/ReportViewer.aspx?%2forac%2fAdministrator%2fdunsmore%2fEnquiries&rs:Command=Render" target="_blank" class="menucontents maintenance">Communication Audit</a>
                    </li>
                    <li style="width: 200px"><a href="@(Url.Action("NextRef", "Leads"))" class="menucontents maintenance">Next Ref</a></li>
                    <li style="width: 200px"><a href="@(Url.Action("Manage", "Operations"))" class="menucontents maintenance">Manage Data</a></li>
                    </ul>
                    </li>
                </ul>
            }
            
            @if (this.User.IsInRole(ApplicationRoles.OutsourcerManagerial))
            {
                <ul style="float: right; margin-right: 0px;">
                    <li style="width: 300px">
                    <a href="#" class="menucontents">Reports</a>
                    <ul>
                    <li style="width: 200px"><a href="@(Url.Action("Tracker", "Outsourcer"))" class="menucontents">Tracker</a></li>
                    <li style="width: 200px"><a href="@(Url.Action("Progress", "Outsourcer"))" class="menucontents">Progress</a></li>
                    <li style="width: 200px"><a href="@(Url.Action("SuppliedData", "Outsourcer"))" class="menucontents">Supplied Data</a></li>
                    <li style="width: 200px"><a href="@(Url.Action("OutputTemplates", "Outsourcer"))" class="menucontents">Output Templates</a></li>
                    <li style="width: 200px"><a href="@(Url.Action("PurchaseOrders", "Outsourcer"))" class="menucontents">Purchase Orders</a></li>
                    </ul>
                    </li>
                </ul>
            }
                        
            @if (this.User.IsInRole(ApplicationRoles.Legal) || this.User.IsInRole(ApplicationRoles.Operations) || this.User.IsInRole(ApplicationRoles.Administrator))
            {
                <ul style="float: right; margin-right: 0px;">
                    <li style="width: 300px">
                    <a href="#" class="menucontents">Reports</a>
                    <ul>
                    @if (this.User.IsInRole(ApplicationRoles.Operations))
                    {
                    <li>
                    <a href="http://webellas.arvixevps.com/ReportServer_SQLEXPRESS/Pages/ReportViewer.aspx?%2forac%2fsurveys%2fOutputTemplate&rs:Command=Render" target="_blank" class="menucontents maintenance">Output Templates</a>
                    </li>    
                    <li>
                    <a href="http://webellas.arvixevps.com/ReportServer_SQLEXPRESS/Pages/ReportViewer.aspx?%2forac%2fsurveys%2fSurveyDetails&rs:Command=Render" target="_blank" class="menucontents maintenance">Question Responses</a>
                    </li>                            
                    <li>
                    <a href="http://webellas.arvixevps.com/ReportServer_SQLEXPRESS/Pages/ReportViewer.aspx?%2forac%2fsurveys%2fExportedData&rs:Command=Render" target="_blank" class="menucontents maintenance">Exported Data</a>
                    </li>                                                    
                    <li>
                    <a href="http://webellas.arvixevps.com/ReportServer_SQLEXPRESS/Pages/ReportViewer.aspx?%2forac%2fsurveys%2fCCsummary&rs:Command=Render" target="_blank" class="menucontents maintenance">Submitted Report</a>
                    </li>                                                                            
                    <li>
                    <a href="http://webellas.arvixevps.com/ReportServer_SQLEXPRESS/Pages/ReportViewer.aspx?%2forac%2fsurveys%2fTodaysProgress&rs:Command=Render" target="_blank" class="menucontents maintenance">Progress By Date</a>
                    </li> 
                    <li>
                    <a href="http://webellas.arvixevps.com/ReportServer_SQLEXPRESS/Pages/ReportViewer.aspx?%2forac%2fsurveys%2fCurrentTracker&rs:Command=Render" target="_blank" class="menucontents maintenance">Tracker</a>
                    </li>                                                                                                                                                                                                                               
                    <li>
                    <a href="http://webellas.arvixevps.com/ReportServer_SQLEXPRESS/Pages/ReportViewer.aspx?%2forac%2fsurveys%2fDailyAnalysis&rs:Command=Render" target="_blank" class="menucontents maintenance">Daily Analysis</a>
                    </li>                                                                                                                                                                                                                               
                    <li>
                    <a href="http://webellas.arvixevps.com/ReportServer_SQLEXPRESS/Pages/ReportViewer.aspx?%2forac%2fsurveys%2fScanningReport&rs:Command=Render" target="_blank" class="menucontents maintenance">Scanning Progress</a>
                    </li>                                                                                                                                                                                                                               
                        
                    }
                    <li style="width: 200px"><a href="@(Url.Action("Index", "CallCentres"))" class="menucontents">Call Centres</a></li>
                    </ul>
                    </li>
                </ul>

            }
            
            @if (this.User.IsInRole(ApplicationRoles.Operations))
            {
            <ul style="float: right;">
                <li style="width: 300px">
                    <a href="#" class="menucontents">Functions</a>
                    <ul>
                        <!--<li><a href="@(Url.Action("CompanyLogos", "Functions"))" class="menucontents">Upload Client Logo</a></li>-->
                        <li><a href="@(Url.Action("ResetLockouts", "Functions"))" class="menucontents">Reset Lockouts</a></li>
                        <li><a href="@(Url.Action("UploadSurveys", "Operations", new { callCentreID = Guid.Empty }))" class="menucontents">Import External Data</a></li>
                        <li><a href="@(Url.Action("UploadSurveyData", "Operations", new { callCentreID = Guid.Empty }))" class="menucontents">Upload Data</a></li>

                    </ul>
                </li>
            </ul>
            }
            
            @if (this.User.IsInRole(ApplicationRoles.OutsourcerManagerial))
            {
            <ul style="float: right;">
                <li style="width: 300px">
                    <a href="#" class="menucontents">Functions</a>
                    <ul>
                        <li><a href="@(Url.Action("UploadSurveys", "Outsourcer"))" class="menucontents">Import Your Data</a></li>
                    </ul>
                </li>
            </ul>
            }

            @if (this.User.IsInRole(ApplicationRoles.Outsourcer) && !this.User.IsInRole(ApplicationRoles.OutsourcerManagerial))
            {
            <label style="color: #800080; text-decoration: blink;">Commence the entering of survey data by posting Contact Information URL into Address Box</label>
            }
            
            @if (this.User.IsInRole(ApplicationRoles.Outsourcer) && 1 == 2)
            {
                <ul style="float: right;">
                    <li>
                    <a href="#" class="menucontents">Surveys</a>
                    <ul>
                        <!--<li><a href="@(Url.Action("EnterLeads", "Outsourcer"))" class="menucontents">Survey by Purchase Order</a></li>-->
                        <li><a href="@(Url.Action("EnterSurvey", "Outsourcer"))" class="menucontents">Survey - Generic</a></li>
                        <li><a href="@(Url.Action("Index", "Outsourcer"))" class="menucontents">View Surveys</a></li>
                        @if (this.User.IsInRole(ApplicationRoles.OutsourcerManagerial))
                        {
                        <li><a href="@(Url.Action("CallCentreStats", "Outsourcer"))" target=_blank class="menucontents">Your Stats</a></li>
                        <li><a href="@(Url.Action("ClientAgentstats", "Outsourcer"))" target=_blank class="menucontents">Client/Agent Stats</a></li>
                        <li><a href="@(Url.Action("LoadingCapacity", "Outsourcer"))" target=_blank class="menucontents">Loading Capacity</a></li>
                        <li><a href="@(Url.Action("CCstats", "Outsourcer"))" target=_blank class="menucontents">Centre Statistics</a></li>                                                        
                        <li><a href="@(Url.Action("ReturnStats", "Outsourcer"))" target=_blank class="menucontents">Return Statistics</a></li>
                        <li><a href="@(Url.Action("Tracker", "Outsourcer"))" target=_blank class="menucontents">Dynamic Tracker</a></li>
                        }
                    </ul>
                    </li>
                </ul>
            }
      
            @if (this.User.IsInRole(ApplicationRoles.Client))
            {
                <ul style="float: right;">
                    <li>
                    <a href="#" class="menucontents">Leads</a>
                    <ul>
                        <li style="width: 200px"><a href="@(Url.Action("FetchLeadBlock", "Client"))" class="menucontents">View Leads</a></li>
                        <li style="width: 200px"><a href="@(Url.Action("ShowReturnsOnly", "Client"))" class="menucontents">View Dunsmore Returns Only</a></li>
                        <li style="width: 200px"><a href="@(Url.Action("Filter", "Client"))" class="menucontents">Filter Leads</a></li>
                        <li style="width: 200px"><a href="@(Url.Action("Tracker", "Client"))" target=_blank class="menucontents">Dynamic Tracker</a></li>
                    </ul>
                    </li>
                </ul>
            }
            @if (this.User.IsInRole(ApplicationRoles.QC))
            {
                <ul style="float: right; margin-right: 0px;">
                    <li>
                    <a href="#" class="menucontents">Leads</a>
                    <ul>
                        <li style="width: 200px"><a href="@(Url.Action("Index", "QC"))" class="menucontents">View Returns</a></li>
                        <li style="width: 200px"><a href="@(Url.Action("Index", "QC"))\?Mode=Pending" class="menucontents">View Pending</a></li>
                        <li style="width: 200px"><a href="@(Url.Action("Index", "QC"))\?Mode=Recall" class="menucontents">Recall Returns</a></li>
                        <li style="width: 200px"><a href="@(Url.Action("QCOrder", "QC"))" class="menucontents">QC Ordered List</a></li>
                        <li style="width: 200px"><a href="http://webellas.arvixevps.com/ReportServer_SQLEXPRESS/Pages/ReportViewer.aspx?%2forac%2fAdministrator%2fdunsmore%2fDailyTracker&rs:Command=Render" target="_blank" class="menucontents maintenance">Daily Tracker</a></li>                        
                    </ul>
                    </li>
                </ul>
            }
            <div style="clear: both;">
            </div>
            </nav>
        </header>

        <div class="maincontent">
        <div id="notice">
        </div>
            @RenderBody()
            @if (this.User.Identity.Name.Length > 0)
            {
                <div class="spacer"></div>
                <div id="campaigns">
                </div>
                <div id="leadslist" class="largepanelleft FancyCorners DropShadow">
                </div>
                <div id="orderslist" class="panelleft FancyCorners DropShadow">
                </div>
                <div id="diarylist" class="FancyCorners DropShadow" style="float:right; margin-top : 10px; border: 1px solid #AAA; border-radius: 8px;">
                </div>
            }
        </div>
        <input type="hidden" id="hdnMaintenance" value="0" />

        <footer>
            <div class="content-wrapper">
                <div class="float-left">
                    <p>&copy; @DateTime.Now.Year - Dunsmore Marketing</p>
                </div>
            </div>
        </footer>
        
        @RenderSection("Scripts", required: false)

        </div>
        </div>
    </body>
</html>

<script type="text/javascript">
    $(document).ready(function () {
            var currentURL=document.URL;
            @{
                string currentURL = Request.Url.ToString();
                if (this.User.IsInRole(ApplicationRoles.Outsourcer))
                {
                <text>
                    $('#leadslist').hide();
                    $('#orderslist').hide();
                    $('#diarylist').hide();
                    $('#notice').hide();
                </text>
                }
                else if (Maintenance.inMaintenance == false && currentURL.IndexOf("/Account/Login") == -1 && (this.User.IsInRole(ApplicationRoles.Administrator) || this.User.IsInRole(ApplicationRoles.Outsourcer) || this.User.IsInRole(ApplicationRoles.QC)))
                {
                <text>
                    $('#leadslist').hide();
                    $('#orderslist').hide();
                    $('#diarylist').hide();
                    $('#notice').hide();
                </text>
                }
                if (Maintenance.inMaintenance == false && currentURL.IndexOf("/Account/Login") == -1 && this.User.IsInRole(ApplicationRoles.Operations))
                {
                <text>
                $('#leadslist').html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Loading...</div></div>');
                $('#leadslist').load('@(Url.Action("Index", "Leads"))');
                //$('#orderslist').html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Loading...</div></div>');
                //$('#orderslist').load('@(Url.Action("Index", "Orders"))');
                $('#orderslist').hide();
                $('#diarylist').html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Loading...</div></div>');
                $('#diarylist').load('@(Url.Action("Index", "Diary"))');
                $('#notice').hide();
                </text>
                }
                else if (Maintenance.inMaintenance == false && currentURL.IndexOf("/Account/Login") == -1 && (this.User.IsInRole(ApplicationRoles.Administrator) || this.User.IsInRole(ApplicationRoles.Sales)))
                {
                <text>
                $("#leadslist").html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Loading...</div></div>');
                $('#leadslist').load('@(Url.Action("Index", "Leads"))');
                $('#diarylist').html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Loading...</div></div>');
                $('#diarylist').load('@(Url.Action("Index", "Diary"))');
                $('#orderslist').hide();
                </text>
                }
                else if (Maintenance.inMaintenance == false && currentURL.IndexOf("/Account/Login") == -1 && (this.User.IsInRole(ApplicationRoles.Administrator)))
                {
                <text>
                $("#leadslist").html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Loading...</div></div>');
                $('#leadslist').load('@(Url.Action("Index", "Leads"))');
                </text>
                }
                else if (Maintenance.inMaintenance == false && currentURL.IndexOf("/Account/Login") == -1 && (this.User.IsInRole(ApplicationRoles.Client)))
                {
                <text>
                $("#notice").hide();
                $("#leadslist").hide();
                $("#orderslist").hide();
                $('#diarylist').hide();
                </text>
                }
                else
                {
                <text>
                $("#leadslist").hide();
                $("#orderslist").hide();
                $('#diarylist').hide();
                </text>
                }
            }
            $("#checkMe2").click( function() {
                $('#leadslist').html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Loading...</div></div>');
                $('#leadslist').load('@(Url.Action("Index", "Leads", new { selectionStatus = "M" }))');
            });

    });
</script>
